package com.wutuo.roster.provider.dao;

import com.wutuo.child.api.response.ChildResponse;
import com.wutuo.roster.api.request.AuditChildApplyRequest;
import com.wutuo.roster.api.request.SearchRosterRequest;
import com.wutuo.roster.api.response.RosterResponse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

public interface RosterMapper extends BaseRosterMapper {

    @SelectProvider(type = RosterSqlProvider.class, method = "lisForPage")
    @ResultType(value = RosterResponse.class) List<RosterResponse> lisForPage(
        SearchRosterRequest request);

    @SelectProvider(type = RosterSqlProvider.class, method = "list")
    @ResultType(value = RosterResponse.class) List<RosterResponse> list(
        AuditChildApplyRequest request);

    @SelectProvider(type = RosterSqlProvider.class, method = "singleList")
    @ResultType(value = RosterResponse.class) List<RosterResponse> singleList(
        SearchRosterRequest request);

    // @Select({ "select count(1) from roster where cm_institution_id =
    // #{institutionId,jdbcType=BIGINT} and del_flag = 1" })
    // int countTotalChild(Long institutionId);

    @SelectProvider(type = RosterSqlProvider.class, method = "countTotalChild") int countTotalChild(
        SearchRosterRequest institutionId);

    /**
     * 查询家长屁孩列表
     *
     * @param request
     * @return List<RosterResponse>
     * @author lvh 2016年2月3日 下午12:34:20</br>
     */
    @SelectProvider(type = RosterSqlProvider.class, method = "getChildListByPid")
    @ResultType(value = ChildResponse.class) List<ChildResponse> getChildListByPid(
        SearchRosterRequest request);

    /**
     * 更新孩子状态
     *
     * @param rosterIds
     * @param type
     * @return void
     * @author lvh 2016年5月5日 下午2:00:08</br>
     */
    @SelectProvider(type = RosterSqlProvider.class, method = "updateRosterState")
    void updateRosterState(@Param("rosterIds") String rosterIds, @Param("type") String type);

}